<?php
namespace app\admin\model;

use think\Model;
use think\Request;

class Company extends Model
{
    public static  function getlist(Request $request)
    {
        $genData = $request->get();
        $genData = getOutpageData($genData);
        if (count($genData)>=2||isset($genData['searchval'])) {
            $fileds = ['company_mobile', 'company_name', 'region_name','realname','company_address'];
            $whereData = genWhereOrData($genData,$fileds);
            $model= makeWhereObject((new self()), $whereData);
        } else {
            $model=  (new self())->where($genData);
        }
        $res = $model->order('id','desc')
//            ->fetchSql(true)
//            ->select();
            ->paginate(10, false,[  'var_page' => 'page']);
        return $res;
    }

}
